<template>
	<div>
		<!--<el-popconfirm :title="`确定推送给'${dataItem.empName}'吗？`" @confirm="onPushWxMsg(dataItem)">
			<el-button slot="reference" class="width-100-percent" size="mini" style="text-align: left;">
				<span style="width: 6px;height: 6px;border-radius: 50%;display: inline-block;margin-right: 4px;" :style="{ background: dataItem.empOpenId ? '#2d8cf0' : '#808695' }"></span>
				<span>{{ dataItem.empName }}</span>
			</el-button>
		</el-popconfirm>-->
		<span>{{ dataItem.empName }}</span>

	</div>
</template>

<script>
    import { wxManageMsgTemplateSendMsgUser } from '../../../../api/production/xsDailyGroupYieldNew';
    import { tipsBar } from '../../../../utils/jk/jk-tool';

    export default {
        props: {
            dataItem: {
                type: Object,
                default() {
                    return {
                        empOpenId: '',
                        empName: '',
                        scheduleShiftName: '',
                        scheduleGroupName: '',
                        totalSalary: '',
                        empOutputKg: ''
                    };
                }
            }
        },
        methods: {
            onPushWxMsg(row) {
                if (row.empOpenId) {
                    const params = {
                        ...row,
                        'openId': row.empOpenId,
                        'empName': row.empName,
                        'time': `${row.belongDate} ${row.scheduleShiftName}/${row.scheduleGroupName}`,
                        'salary': row.totalSalary,
                        'qty': row.empOutputKg,
                        'machineList': row.machineList
                    };
                    wxManageMsgTemplateSendMsgUser(params).then(res => {
                        if (res.data.status === 200) {
                            tipsBar(this, 'custom', 'success', '推送成功!');
                        }
                    });
                } else {
                    tipsBar(this, 'custom', 'warning', `'${row.empName}'未绑定微信，无法推送!`);
                }
            }
        }
    };
</script>
